function idata = dcm_PixelData(hfile)
% DCM::PixelData  - return image data as 1xN data array
%
% FORMAT:       pixels = dcm.PixelData;
%
% Output fields:
%
%       pixels      pixel data (1xN array!)

% Version:  v0.7b
% Build:    7083008
% Date:     Aug-30 2007, 8:58 AM CEST
% Author:   Jochen Weber, Brain Innovation, B.V., Maastricht, NL
% URL/Info: http://wiki.brainvoyager.com/BVQXtools

% only valid for single file
if nargin < 1 || ...
    numel(hfile) ~= 1 || ...
   ~isBVQXfile(hfile, 'dcm')
    error( ...
        'BVQXfile:BadArgument', ...
        'Invalid call to %s.', ...
        mfilename ...
    );
end

% check key
bc = bvqxfile_getcont(hfile.L);
if ~isfield(bc.DataKeyLookup, 'k_7FE0_0010')
    error( ...
        'BVQXfile:BadObject', ...
        'Object does not contain image data.' ...
    );
end
idata = bc.Data(bc.DataKeyLookup.k_7FE0_0010).Value;
